import router from "./router";
import storage from './utils/auth'




router.beforeEach((to, from, next) => {
    let token = storage.getToken()
    if (token) {
        if (to.path === '/login') {
            next(from.path)
        } else {
            next()
        }
    } else {
        if (to.path === '/login') {
            next()
        } else {
            next('/login')
        }
    }
})